package com.py.korona.datasource;

import java.util.ArrayList;
import java.util.List;
import com.py.korona.db.geo.Screenshot;

public class ScreenshotDatasource {
    private List<Screenshot>                     screenshots;
    private static volatile ScreenshotDatasource instance_;

    public static ScreenshotDatasource getInstance() {
        ScreenshotDatasource localInstance = instance_;
        if (null == localInstance) {
            synchronized (ScreenshotDatasource.class) {
                localInstance = instance_;
                if (null == localInstance) {
                    instance_ = localInstance = new ScreenshotDatasource();
                }
            }
        }
        return localInstance;
    }

    public ScreenshotDatasource() {
        screenshots = new ArrayList<Screenshot>();
    }

    public int insertScreenshot(Screenshot screenshot) {
        screenshots.add(screenshot);
        return screenshots.size();
    }

    public void removeScreenshotAtIndex(int index) throws UnsupportedOperationException, IndexOutOfBoundsException {
        screenshots.remove(index);
    }
}
